<template>
	<view class="content">
		<view class="head">我的报名信息</view>
		<view class="main">
			<view class="core" v-for="(data,index) in myCompetitionList" :key=index @click="enteCompetition(data.id,data.submitCompleted,data.competitionId)"   >
				<text style="color: #585858;">{{data.registrationCompetition.competitionDescribe}}</text>
				<view class="p">报名时间:{{data.registrationCompetition.competitionStart}} 至 {{data.registrationCompetition.competitionFinish}}</view>
				<view class="f">
					<view v-if="data.submitCompleted == 0" style="color: rgb(238,10,36);">报名信息需完善</view>
					<view v-else >
						<view v-if="data.participateStatus == 1" style="color: #F0AD4E;	">已提交报名信息,未进入海选</view>
						<view v-else-if="data.participateStatus == 2">赛事进度:进入海选 | 获赞数量:2341</view>
					</view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	import my from '@/api/my.js'
	
	
	export default {
		data() {
			return {
				tokenOpenid:"",
				myCompetitionList:[]
			}
		},
		async onLoad(){
			//获取用户openid存储一下
			this.tokenOpenid = uni.getStorageSync("token_openid");
		},
		async onShow(){
			//获取赛事信息
			await this.getMyCompetitionList()
		},
		methods: {
			getMyCompetitionList(){
				let data ={
					openId:this.tokenOpenid
				}
				my.getMyCompetitionList(data).then(res=>{
					console.log(res)
					if(res.code == 200){
						console.log(res.data)
						this.myCompetitionList = res.data
					}
				})
			},
			enteCompetition(id,type,competitionId){

				let data ={
					openId:this.tokenOpenid,
					competitionId:id
				}
				if(type == 1){
					uni.navigateTo({
						url:'../submitForm/submitForm?id='+id
					})
				}else if(type == 0 ){
					my.is_possible_register(data).then(res=>{
						uni.navigateTo({
							url:'../signUp/signUp?id='+competitionId
						})
					})
				}
				
			}
		}
	}
</script>

<style lang="scss" scoped>
.content{
	margin: 20px 40px 0;

	.head{
		color: #585858;
		font-size: 40rpx;
		font-weight: 600;
		margin-bottom: 100rpx;
	}
	.main{
		.core{
			margin-top: 20rpx;
			background-color: rgb(234,243,255);
			box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
			border-radius: 40rpx;
			padding: 40rpx 40rpx;
			.p{
				margin-top: 20rpx;
				color: #888888;
				font-size: 30rpx;
			}
			.f{
				margin-top: 10rpx;
				font-size: 25rpx;
				color: rgb(25,121,255);
			}
		}
	}
}
</style>
